<!DOCTYPE HTML>
<style type="text/css">
	.file-default{
                width:20px;
                height:17px;
				display:inline-block;
    }
	.file-icon{
        background: url("__PUBLIC__/images/glyphicons-halflings.png") -95px -68px no-repeat;
    }

</style>

<!-- <no_layout name="Layout\layout" />  -->
<div class="form-three widget-shadow card pressthis">
		<form class="form-horizontal" method="post" action="__URL__/setResponse"  enctype="multipart/form-data">
			<div class="form-group">
				<label for="radio" class="col-sm-2 control-label" style="color:#ea0000;">参考答案：</label>
				<div class="col-sm-8">
					<div class="radio-inline"><label> <a href="http://ow365.cn/?i=10124&furl={$answers}" target="_blank">在线查看</a></label></div>
					<div class="radio-inline"><label> <a href="{$answers}">下载</a></label></div>
				</div>			
			</div>
			<div class="form-group">
				 
				<label for="radio" class="col-sm-2 control-label" ><div class="file-default file-icon"></div>需批改的作业：</label>
				<div class="col-sm-8">
					<div class="radio-inline"><label> <a href="http://ow365.cn/?i=10124&furl=__UPLOAD__{$filesavename}" target="_blank">在线查看</a></label></div>
					<div class="radio-inline"><label> <a href="__UPLOAD__{$filesavename}">下载</a></label></div>
				</div>			
			</div>
			<hr />
			
				<div class="form-group" >
					<label for="radio" class="col-sm-2 control-label" >请上传批改后的作业：</label>
					<div class=" compose-right col-md-12" style="margin-left:0;    padding-right: 15px;padding-left: 15px;">																																					
						<div class="btn btn-default btn-file">
							<i class="fa fa-paperclip"></i> 选择文件
							<input type="file" name="homeworkFile" onchange="$('#filenotice').html($('[name=homeworkFile]').val());	"/>
							<div class="showFileName"></div>
							<div class="fileerrorTip"></div>
						</div>
						<p class="help-block" id="filenotice">Max. 3MB(正则）</p>																														
					</div>					
				</div>			
					
			<for start="1" end='$list_verification' name="i">			
			<div class="form-group">
				<label for="radio" class="col-sm-2 control-label" style="color:#337ab7;">程序验证 第{$i}题：</label>
				<div class="col-sm-8">
					<div class="radio-inline"><label><input type="radio" name="score{$i}" value="1"> 对</label></div>
					<div class="radio-inline"><label><input type="radio" name="score{$i}" value="0"> 错</label></div>
				</div>			
			</div>
			</for>
			<for start="$i" end='$i+$list_cloze_error_correction-1' name="j">			
			<div class="form-group">
				<label for="radio" class="col-sm-2 control-label" style="color:#31708f;">填空改错 第{$j-$i+1}题：</label>
				<div class="col-sm-8">
					<div class="radio-inline"><label><input type="radio" name="score{$j}" value="1"> 对</label></div>
					<div class="radio-inline"><label><input type="radio" name="score{$j}" value="0"> 错</label></div>
				</div>			
			</div>
			</for>
			<for start="$j" end='$j-1+$list_programme' name="k">			
			<div class="form-group">
				<label for="radio" class="col-sm-2 control-label" >编程题 第{$k-$j+1}题：</label>
				<div class="col-sm-8">
					<div class="radio-inline"><label><input type="radio" name="score{$k}" value="1"> 对</label></div>
					<div class="radio-inline"><label><input type="radio" name="score{$k}" value="0"> 错</label></div>
				</div>			
			</div>
			</for>
			<div class="form-group">
				<label for="radio" class="col-sm-2 control-label" >心得体会：</label>
				<div class="col-sm-8">
					<div class="radio-inline"><label><input type="radio" name="score{$k}" value="3"> 3</label></div>
					<div class="radio-inline"><label><input type="radio" name="score{$k}" value="2"> 2</label></div>
					<div class="radio-inline"><label><input type="radio" name="score{$k}" value="1"> 1</label></div>
					<div class="radio-inline"><label><input type="radio" name="score{$k}" value="0"> 未写</label></div>
				</div>			
			</div>
			<div class="form-group">
				<label for="txtarea1" class="col-sm-2 control-label">评价：</label>
				<div class="col-sm-8"><textarea name="review" id="review" cols="50" rows="10" placeholder="你的评价" class="form-control1" style="height:100px;"></textarea></div>
			</div>
			<div class="forms"  id="btn_submit">
				<button type="submit" class="btn btn-default" id="btn_submitscore" style="    margin-right: 200px;">Submit</button>
			</div>
				<input name="openid" id="openid" value="{$openid}" type="hidden"  />
				<input name="chapter" id="chapter" value="{$chapter}" type="hidden"  />
				<input name="filesavename" id="filesavename" value="{$filesavename}" type="hidden"  />
		</form>
	</div>
	
		 <script>
			//console.log('对象：',obj1);
		
			var num =new Array();
			function radio(checkbox) {
			//alert(checkbox);
				var optname = $(checkbox).attr("name");
				if(num.indexOf(optname)<0){
					num.push(optname);
				}
				$('input[name='+optname+']').prop('checked', false);
				$(checkbox).prop('checked',true);
				answer = $(checkbox).attr("id");
		    }

			var url = document.URL;
			if(url.indexOf("test_num") != -1){
				$("html,body").animate({scrollTop:$("#content-tabs").offset().top-$("#main-collect-page").offset().top},500);	
			}
			function changeMark()
			{																								
				$('#mark').attr("disabled","disabled");																	
				$('#mark').css('color','#777');	
							
			}			
			if('{$isExercise}' == "0"){
				$('#analysis-tab').hide();
				$("#exerciseTip").hide();
				
			}
			
			//实现每5s获取答题人数的功能
			function getSubmitNum() { 
				var ajaxData ={};
				ajaxData['test_num_id']=$("#test_num_id").val();			
				$.post("{:U('Inclass/getSubmitNum')}",ajaxData,
					function(data) { 
					var d = data.toString(); 
					$("#person_num").html("已提交："+d+"人"); 
				});
			} 
			$(function() { 
				//timeID = setInterval('getSubmitNum()', 5000); //注意:执行的函数需要加引号,否则会报错的 
			}); 
			//===========================
			$("#submit").click(function(){
				for(var i=0;i<{$i};i++){
					if(num.length<{$i}){
						//alert("请填写所有试题");						
						//return false;
				 
					}
				}
				
			});
			$("#setItemList").click(function(event){				
				//$("#myLoading").show();
				event.preventDefault();	
					if($("#selector1").val() == ''){
						alert("请选择任务！");
						return false;
					}
							
				var ajaxData ={};
				ajaxData['chapter'] = $("#selector1").val();
				ajaxData["openid"] 	= $('#openid').val();;				
				//ajaxData['__hash__'] = $('[name=__hash__]').attr('content');		
				//ajaxData['__hash__'] = document.getElementsByName("__hash__")[0].content;		
				$.post("{:U('Homework/getPeerDetail')}",
					ajaxData,
					function(data,status){
					// alert("Data: " + data + "nStatus: " + status);
						$("#main-collect-page").html(data);
				});
				//$("html").text(jsApiParameters);
				//window.location.reload();		
			});
			$("#btn_submitscore").click(function(event){	
				if($('input[name=homeworkFile]').val()== ""){
					alert("请选择批改后的文件！");					
					return false;
				}
				
				for(var i=1;i<{$j};i++){
					var tmp = $(":radio[name=score"+i+"]:checked").val();
					if(typeof tmp =="undefined"){
						alert("请批改！");					
						return false;
					}
				}				
			});
		
		</script> 
	<!-- main content end-->
